#!/bin/bash

set -e

# 990 或 9a0 不使用此启动安装程序的方式
if egrep -qi 'kirin.?9[09]0' /proc/cpuinfo; then
    exit 0
fi

if ! grep -q live /proc/cmdline; then

    if [[ -e /etc/xdg/autostart/ukui-kwin.desktop ]]; then
         mv /etc/xdg/autostart/ukui-kwin.desktop  /
    fi
    if [[ -e /etc/xdg/autostart/kwin.desktop ]]; then
         mv /etc/xdg/autostart/kwin.desktop  /
    fi

    rm -rf /etc/xdg/autostart
    mkdir -p /etc/xdg/autostart

    if [[ -e /ukui-kwin.desktop ]]; then
   	 mv /ukui-kwin.desktop /etc/xdg/autostart/
    fi
    if [[ -e /kwin.desktop ]]; then
   	 mv /kwin.desktop /etc/xdg/autostart/
    fi

    cp /usr/share/applications/kylin-os-installer.desktop /etc/xdg/autostart
    rm -f /usr/bin/peony-qt-desktop || true
fi


